package com.jd.fruit.model.mobile;

import java.io.IOException;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.jd.fruit.common.annotation.Controller;
import com.jd.fruit.common.controller.BaseController;
import com.jd.fruit.common.util.DictUtil;
import com.jd.fruit.model.admin.shop.Category;
import com.jd.fruit.model.admin.shop.SetShop;
import com.jfinal.kit.StrKit;
/**
 * web店铺设置
 * @author admin
 *
 */
@Controller("/admin/mobile")
public class SetShopController extends BaseController{

	public void index(){
		render("/mobile/setshop/setshop.html");
	}
	/**
	 * 店铺信息
	 */
	public void list(){
		String iphone_no="18500357242";
			//this.getPara("iphone_no");
		SetShop shop=SetShop.dao.findByIhone(iphone_no);
		this.setAttr("shops", shop);
	}
	/**
	 * 保存设置信息
	 */
	public void save(){
		
	}
	
	/**
	 * 加载商品分类属性Jason数据
	 * 
	 * @throws IOException
	 */
	public void loadData() {
		String iphone_no = getPara("iphone_no");
		String result = "";
		JSONArray jsarray = null;
		if (!StrKit.isBlank(iphone_no) && iphone_no.equals(DictUtil.jsontree)) {
			jsarray = SetShop.dao.findById(iphone_no);
			if (jsarray != null) {
				result = jsarray.toJSONString();
			}
		} else {
			result = Category.dao.loadTreeGrid();
		}
		renderJson(result);
	}
}
